<!DOCTYPE html>
<html lang="en">
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>

<head>
    <meta charset="UTF-8">
    <title>静态页面-ajax上传</title>

</head>
<body>
<div id="result"></div>
<input type="file" id="file">
<input type="button" value="上传" onclick="uploadFile()">
<script>
    function uploadFile() {
        var file = $("#file")[0].files[0];
        var formData = new FormData();
        formData.append("file",file);
        $.ajax({
            type:'post',
            url:'/upload',
            processData:false,
            contentType:false,
            data:formData,
            success:function(msg) {
                alert("sb")
                $('#result').html(msg)
            }
        })
    }
</script>

</body>
</html>